const UserModel = require("../models/UserModel");

const UserService = {
  // 查找用户
  findUser: async (email) => {
    return UserModel.findOne({
      email,
    });
  },
  // 添加用户
  add: async ({ name, email, avatar, password, identity }) => {
    return UserModel.create({ name, email, avatar, password, identity });
  },
  findById: async (id) => {
    return UserModel.findById(id);
  },
};
module.exports = UserService;
